/**
 *   __         ___
 *  |   |   |  |     | /
 *  |__ |   |  |     |/\
 *  |   |___|  |___  |  \ мой мозг. работа этого скрипта проверялась только в FF3
 */

function show_tip (element, text) {
	
	if (document.getElementById ("tip") != null) document.body.removeChild (document.getElementById ("tip"));
	
	var bounds = getBounds(element);
	var x = bounds.left + bounds.width + 7;
	var y = bounds.top + bounds.height + document.body.scrollTop + 7;
	
	var tip = document.createElement ("div");
	tip.id = "tip";
	tip.style.top = y + "px";
	tip.style.left = x + "px";
	tip.innerHTML = text;
	
	document.body.appendChild (tip);
}

function close_tip () {
	if (document.getElementById ("tip") != null) document.body.removeChild (document.getElementById ("tip"));
}

function getBounds(element) {
	var left = element.offsetLeft;
	var top = element.offsetTop;
	for (var parent = element.offsetParent; parent; parent = parent.offsetParent) {
		left += parent.offsetLeft - parent.scrollLeft;
		top += parent.offsetTop - parent.scrollTop
	}
	return {left: left, top: top, width: element.offsetWidth, height: element.offsetHeight};
}